/*
 * fir.h
 *
 *  Created on: Jun 17, 2024
 *      Author: 17850
 */


/*
#ifndef INC_FIR_H_
#define INC_FIR_H_

#include <stdint.h>
// 定义 FIR 滤波器结构体
typedef struct {
    uint16_t numTaps;    // 滤波器系数个数
    float *pState;   // 状态变量指针，长度为 numTaps + blockSize - 1
    float *pCoeffs;  // 系数指针，长度为 numTaps
} arm_fir_instance_f32;

extern void arm_copy_f32(const float *src, float *dst, uint32_t length);

extern void arm_fir_f32(const arm_fir_instance_f32 *S, const float *pSrc, float *pDst, uint32_t blockSize);
extern void arm_fir_init_f32(arm_fir_instance_f32 *S, uint16_t numTaps, float *pCoeffs, float *pState, uint32_t blockSize);


#endif
*/

/////////

#ifndef FIR_H
#define FIR_H

#include <stdint.h>

// 定义浮点 FIR 滤波器实例结构体
typedef struct {
    uint16_t numTaps;     // Number of filter coefficients in the filter.
    float *pState;    // Points to the state variable array. The array is of length numTaps+blockSize-1.
    float *pCoeffs;   // Points to the coefficient array. The array is of length numTaps.
} arm_fir_instance_f32;

// FIR 滤波器初始化函数
void arm_fir_init_f32(
    arm_fir_instance_f32 *S,
    uint16_t numTaps,
    const float *pCoeffs,
	float *pState,
    uint32_t blockSize);

// FIR 滤波器执行函数
void arm_fir_f32(
    const arm_fir_instance_f32 *S,
    const float *pSrc,
	float *pDst,
    uint32_t blockSize);

#endif // FIR_H
